/**
 * Created by xiaom on 2016/11/3.
 */
import React, {Component, PropTypes} from 'react';
import shouldUpdate from '../shouldUpdate/index';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import classNames from 'classnames';
import './index.scss';

class Wrapper extends Component {

  constructor(props) {
    super(props);
    this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
  }

  static propTypes = {
    className: PropTypes.string
  };

  shouldComponentUpdate(nextProps = {}, nextState = {}) {
    return shouldUpdate(this, nextProps, nextState);
  }

  render() {
    const {className, children, ...others} = this.props;

    const cns = classNames({
      'wrapper': true,
      [className]: className
    });

    return (
      <div className={cns} {...others}>
        {children}
      </div>
    );
  }
}

export default Wrapper;
